<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_Reviews extends Controller_Admin_Base
{
    public function action_index()
    {    
        $model_id = $this->request->param('id') ? $this->request->param('id') : 0;
        $page     = $this->request->param('page') ? $this->request->param('page') : 1;
        
        $content = new View('admin/reviews/index_tpl');

        $model = ORM::factory('model', $model_id);
        $content->reviews = Model_Review::get_reviews($model, $page);
        $content->model   = $model;
        $content->count   = $model->count_reviews;
        $content->pagination = array(
            'page' => $page,
            'per_page' => Model_Review::get_reviews_per_page(),
        );
    
        $this->print_template('Отзывы', $content); 
    }
} 
